home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Aminet / gfx / edit / AmiCAD_2.07.lha / AmiCAD / ARexx / CadrerTexte.AmiCAD < prev    next >
Text File  |  2000-11-04  |  3KB  |  88 lines

  1. /* Création d'un cadre avec effet de relief autour d'un ou de plusieurs textes */
  2. /* Version 1.00: © R.Florac, Samedi 28 Mars 1998 */
  3. /* Version 1.01: 13/04/98 */
  4. /* Version 1.02: 07/06/98 Correction bug SAVEALL */
  5. /* Version 1.03: 14/07/98 modification tracé lignes (lignes personnalisées) */
  6. /* Version 1.04: 06/02/99 conservation du mode de tracé (utilisation DRAWMODE) */
  7. /* Version 1.05: 25/05/99 modification placement traits horizontaux */
  8. /* Version 1.06: 13/04/00 modification gestion SAVEALL */
  9. /* Version 1.07: 04/11/00 ajout traitement rotations et symétries textes, localisation */
  10. /* $VER: CadrerTexte 1.07 (© R.Florac, 04/11/00) */
  11. /* Les références ou valeurs de composants ne sont pas acceptées */
  12.  
  13. options results     /* indispensable pour récupérer le résultat des macros */
  14.  
  15. signal on error     /* pour l'interception des erreurs */
  16. signal on syntax
  17.  
  18. 'LANGUAGE'
  19. if result="français.language" then fr=1
  20. else fr=0
  21.  
  22. 'FIRSTSEL'; objet=result
  23. if objet=0 then do
  24.     if fr=1 then 'MESSAGE("Sélectionnez d''abord"+CHR(10)+"les textes à encadrer")'
  25.     else 'MESSAGE("There is no text"+CHR(10)+"that is selected.")'
  26.     exit
  27. end
  28.  
  29. xg=100000; xd = 0; yh = 10000; yb = 0; textes=objet
  30. do while objet>0
  31.     'TYPE('objet')'
  32.     if result ~= 4 then do
  33.     'BLINK('objet')'
  34.     if fr=1 then 'MESSAGE("Objet de type incorrect"+CHR(10)+"Ne sélectionnez que"+CHR(10)+"des textes S.V.P.")'
  35.     else 'MESSAGE("Incorrect object type"+CHR(10)+"Select only texts.")'
  36.     exit
  37.     end
  38.     'GETPOS('objet')'; rot=result
  39.     if rot<0 then rot=-rot
  40.     'COORDS('objet')'; coord=result
  41.     PARSE VAR coord x0 ',' y0
  42.     if rot=3 then do
  43.     if x0>xd then xd=x0
  44.     end
  45.     else do
  46.     if x0<xg then xg=x0
  47.     end
  48.     if y0>yb then yb=y0
  49.     'WIDTH('objet')'; w=result
  50.     if rot=3 | rot=4 then do
  51.     if x0>xd then xd=x0
  52.     x0=x0-w
  53.     if x0<xg then xg=x0
  54.     end
  55.     else do
  56.     x0=x0+w
  57.     if x0>xd then xd=x0
  58.     end
  59.     'HEIGHT('objet')'; h=result
  60.     if rot=2 | rot=3 then do
  61.     if y0<yh then yh=y0
  62.     y0=y0+h
  63.     if y0>yb then yb=y0
  64.     end
  65.     else do
  66.     if y0>yb then yb=y0
  67.     y0=y0-h
  68.     if y0<yh then yh=y0
  69.     end
  70.     textes=textes||','||objet
  71.     'NEXTSEL('objet')'; objet=result
  72. end
  73. xg=xg-4; xd=xd+6; yh=yh-1; yb=yb+2
  74. 'SAVEALL:MODE_TRACÉ=DRAWMODE(-1):MARK(L1=DRAW('xg','yh','xd','yh')):MARK(L2=DRAW('xg','yh','xg','yb')):DRAWMODE(-2):MARK(L3=DRAW('xd','yh'+1,'xd','yb')):MARK(L4=DRAW('xg'+1,'yb','xd','yb')):GROUP('textes',L1,L2,L3,L4):DRAWMODE(MODE_TRACÉ)'
  75. exit
  76.  
  77. /* Traitement des erreurs, interruption du programme */
  78. syntax:
  79. erreur=RC
  80. if fr=1 then 'MESSAGE("Script CadrerTexte"+CHR(10)+"Erreur de syntaxe"+CHR(10)+"en ligne 'SIGL'"+CHR(10)+"'errortext(erreur)'")'
  81. else 'MESSAGE("CadrerTexte Script"+CHR(10)+"Syntax error"+CHR(10)+"in line 'SIGL'"+CHR(10)+"'errortext(erreur)'")'
  82. exit
  83.  
  84. error:
  85. if fr=1 then 'MESSAGE("Script CadrerTexte"+CHR(10)+"Erreur en ligne 'SIGL'")'
  86. else 'MESSAGE("CadrerTexte Script"+CHR(10)+"Error in line 'SIGL'")'
  87. exit
  88.